<?php
declare (strict_types=1);

namespace app\controller;

use think\facade\Db;
use think\facade\View;
use think\Request;

class Report
{
    /**
     * 显示资源列表
     *
     * @return string|\think\Response
     */
    public function index(Request $request)
    {
        //
        $app_name = Db::table('app')->where(['id' => 1])->find();
        $urls = Db::table('urls')->where(['app_id' => 1])->select();
        $urls_count = Db::table('urls')->where(['app_id' => 1])->count();
        $urls_sqlmap = Db::table('urls_sqlmap')->where(['app_id' => 1])->select();
        $urls_sqlmap_count = Db::table('urls_sqlmap')->where(['app_id' => 1])->count();
        $host_port = Db::table('host_port')->where(['app_id' => 1])->select();
        $host_port_count = Db::table('host_port')->where(['app_id' => 1])->count();
        $host = Db::table('host')->where(['app_id' => 1])->select();
        $host_count = Db::table('host')->where(['app_id' => 1])->count();
        $app_crawlergo = Db::table('app_crawlergo')->where(['app_id' => 1])->select();
        $app_crawlergo_count = Db::table('app_crawlergo')->where(['app_id' => 1])->count();
        $app_nuclei = Db::table('app_nuclei')->where(['app_id' => 1])->select();
        $app_nuclei_count = Db::table('app_nuclei')->where(['app_id' => 1])->count();
        $app_info = Db::table('app_info')->where(['app_id' => 1])->select();
        $app_info_count = Db::table('app_info')->where(['app_id' => 1])->count();
        $project_tools = Db::table('project_tools')->where(['project_id' => 1])->select();
        return View::fetch('index', [
            'app_name' => $app_name,
            'urls' => $urls,
            'urls_count' => $urls_count,
            'urls_sqlmap' => $urls_sqlmap,
            'urls_sqlmap_count' => $urls_sqlmap_count,
            'host_port' => $host_port,
            'host_port_count' => $host_port_count,
            'host' => $host,
            'host_count' => $host_count,
            'app_crawlergo' => $app_crawlergo,
            'app_crawlergo_count' => $app_crawlergo_count,
            'app_nuclei' => $app_nuclei,
            'app_nuclei_count' => $app_nuclei_count,
            'app_info' => $app_info,
            'app_info_count' => $app_info_count,
            'project_tools'=> $project_tools,
        ]);
    }

    /**
     * 显示创建资源表单页.
     *
     * @return \think\Response
     */
    public function create()
    {
        //
    }

    /**
     * 保存新建的资源
     *
     * @param \think\Request $request
     * @return \think\Response
     */
    public function save(Request $request)
    {
        //
    }

    /**
     * 显示指定的资源
     *
     * @param int $id
     * @return \think\Response
     */
    public function read($id)
    {
        //
    }

    /**
     * 显示编辑资源表单页.
     *
     * @param int $id
     * @return \think\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * 保存更新的资源
     *
     * @param \think\Request $request
     * @param int $id
     * @return \think\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * 删除指定资源
     *
     * @param int $id
     * @return \think\Response
     */
    public function delete($id)
    {
        //
    }
}
